#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define nl '\n'
#define int long long
#define ll long long
#define pii pair<ll, ll>
#define mod 998244353 // 998244353 1000000007
using namespace std;
void solve()
{
int n1, n2, n3;
cin >> n1 >> n2 >> n3;
int a[n1], b[n2], c[n3];
int sum = 0, sum1 = 0, sum2 = 0, sum3 = 0;
for(int i = 0; i < n1; i++)
{
cin >> a[i];
sum += a[i];
sum1 += a[i];
}
for(int i = 0; i < n2; i++)
{
cin >> b[i];
sum += b[i];
sum2 += b[i];
}
for(int i = 0; i < n3; i++)
{
cin >> c[i];
sum += c[i];
sum3 += c[i];
}
sort(a, a + n1);
sort(b, b + n2);
sort(c, c + n3);
int ans = 0;
if(n1 == 1)
{
ans = max(ans, sum - 2LL*a[0]);
}
if(n2 == 1)
{
ans = max(ans, sum - 2LL*b[0]);
}
if(n3 == 1)
{
ans = max(ans, sum - 2LL*c[0]);
}
ans = max(ans, sum - 2LL*(a[0] + b[0]));
ans = max(ans, sum - 2LL*(a[0] + c[0]));
ans = max(ans, sum - 2LL*(c[0] + b[0]));
if(n1 > 1 and n1 <= (n2 + n3 - 1))
{
ans = max(ans, sum - 2LL*(sum1));
}
if(n2 > 1 and n2 <= (n1 + n3 - 1))
{
ans = max(ans, sum - 2LL*(sum2));
}
if(n3 > 1 and n3 <= (n1 + n2 - 1))
{
ans = max(ans, sum - 2LL*(sum3));
}
ans = max(ans, sum1 - (sum2 + sum3));
ans = max(ans, sum2 - (sum1 + sum3));
ans = max(ans, sum3 - (sum2 + sum1));
ans = max(ans, sum2 + sum3 - sum1);
ans = max(ans, sum1 + sum2 - sum3);
ans = max(ans, sum3 + sum1 - sum2);
cout << ans << nl;
}
signed main()
{
// ios_base::sync_with_stdio(false), cin.tie(nullptr);
int t1 = 1;
// cin >> t1;
while(t1--)
{
solve();
}
}
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |
222. Count Complete Tree Nodes | 215. Kth Largest Element in an Array |
198. House Robber | 153. Find Minimum in Rotated Sorted Array |
150. Evaluate Reverse Polish Notation | 144. Binary Tree Preorder Traversal |
137. Single Number II | 130. Surrounded Regions |
129. Sum Root to Leaf Numbers | 120. Triangle |
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |
71. Simplify Path | 62. Unique Paths |